package io;

import java.io.*;

/**
 *
 */
public class PwDemo {
    public static void main(String[] args) throws FileNotFoundException {
        //
        //printWriter
        PrintWriter pw=new PrintWriter("pw.txt");
        pw.println("hello world");
        pw.println("hello,hello!!");
        System.out.println("写入完毕!");
        pw.close();

        //内部四层流连接
        //文件流
        FileOutputStream fis=new FileOutputStream("pw.txt");
        //转换流
        OutputStreamWriter osw=new OutputStreamWriter(fis);
        //缓冲流
        BufferedWriter bw=new BufferedWriter(osw);
        //字符输出流
        PrintWriter pw2=new PrintWriter(bw);
        pw2.println("哒，哒~~~~");
        pw2.println("哒，哒~~~~");
        System.out.println("写入完毕!");
        pw2.flush();//冲水










    }
}
